
<script>
import { useUserStore } from '@/wind/main';

export default {
  setup() {
    const userStore = useUserStore();

    // 读取用户信息
    const user = userStore.getUser();
    
    // 设置用户信息
    const setUser = () => {
      // 从 API 或其他地方获取用户信息
      const newUser = { name: 'John Doe', email: 'john@example.com' };
      userStore.setUser(newUser);
    };

    // 注销用户
    const logout = () => {
      userStore.logout();
    };

    return { user, setUser, logout };
  },
};
</script>